package com.hspedu.furn.lambda;

import sun.security.krb5.internal.crypto.Des;

public class Test {
    public static void main(String[] args) {

        HspFunction<Desk,String> hf2 = Desk::getBrand;

        String val2 = hf2.apply(new Desk());
        System.out.println("val2-" + val2);

        HspFunction<Desk,Object> hf3 = Desk::getId;
    }
}


@FunctionalInterface
interface HspFunction<T, R> {
    R apply(T t); //抽象方法: 表示根据类型T的参数，获取类型R的结果

    //函数式接口，依然可以有多个默认实现方法
    default public void ok() {
        System.out.println("ok");
    }
}

@FunctionalInterface
interface HspInterface {
    public void hi();
}

class Desk { //Bean
    private String name = "hsp desk";
    private String brand = "北京牌";
    private Integer id = 10;

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getBrand() {
        return brand;
    }


}